package my.package0421;

import java.util.Scanner;

public class AreaDome {
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        System.out.println("计算图形的面积：1、圆形 2、长方形");
        int choosenumber = sc.nextInt();

        Area area = new Area();

        if (choosenumber == 1){
            System.out.println("请输入圆形的半径：");
            double radius = sc.nextDouble();
            System.out.println("圆形的面积："+String.format("%.2f",area.caculateArea(radius)));
        }else if (choosenumber ==2){
            System.out.println("长方形的长：");
            int length = sc.nextInt();
            System.out.println("长方形的宽：");
            int width = sc.nextInt();
            System.out.println("长方形的面积："+ area.caculateArea(length,width));
        }else{
            System.out.println("输入错误！");
        }
    }
}
